package org.jeecg.modules.pjinfo.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.pjinfo.entity.PjInfo;
import org.jeecg.modules.pjinfo.mapper.PjInfoMapper;
import org.jeecg.modules.pjinfo.service.IPjInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;
import java.util.Map;

/**
 * @Description: PJ_INFO
 * @Author: jeecg-boot
 * @Date:   2021-08-24
 * @Version: V1.0
 */
@Service
public class PjInfoServiceImpl extends ServiceImpl<PjInfoMapper, PjInfo> implements IPjInfoService {

    @Autowired
    private PjInfoMapper pjInfoMapper;

    @Override
    public List<Map<String, Object>> getuser(String bmcode) {
        return pjInfoMapper.getuser(bmcode);
    }

    @Override
    public Page<PjInfo> querypjinfoshlist(Page<PjInfo> pageList, PjInfo pjInfo) {
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();


        pjInfo.setPjShuserid(sysUser.getId());

        return  pageList.setRecords(pjInfoMapper.querypjinfoshlist(pageList, pjInfo));
    }

    @Override
    public Page<PjInfo> querypjinfolists(Page<PjInfo> pageList, PjInfo pjInfo) {
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        pjInfo.setPjUserid(sysUser.getId());
        return  pageList.setRecords(pjInfoMapper.querypjinfolists(pageList, pjInfo));
    }

    @Override
    public String getdepid(String pjBm) {
        return pjInfoMapper.getdepid(pjBm);
    }

    @Override
    public List<Map<String,Object>> getinfobyuserid(String id) {
        return pjInfoMapper.getinfobyuserid(id);
    }

    @Override
    public  List<Map<String,Object>> getuseridbydepart(String pjBm) {
        return pjInfoMapper.getuseridbydepart(pjBm);
    }
}
